//
//  DMCustomViewController.m
//  DMGME
//
//  Created by MC on 15/10/14.
//  Copyright © 2015年 GYP. All rights reserved.
//

#import "DMCustomViewController.h"

@interface DMCustomViewController ()
{
    UIStatusBarStyle mStatusBarStyle;
}
@property (nonatomic,strong)  UILabel *text;
@end

@implementation DMCustomViewController
-(void)viewWillAppear:(BOOL)animated
{
    _text.hidden = NO;
}

-(void)viewWillDisappear:(BOOL)animated
{
    _text.hidden = YES;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.conversationType = ConversationType_PRIVATE;
    
    [self.chatSessionInputBarControl setInputBarType:RCChatSessionInputBarControlDefaultType style: RC_CHAT_INPUT_BAR_STYLE_SWITCH_CONTAINER];

    
    _text = [[UILabel alloc] initWithFrame: CGRectMake(0, 15, KWidth, 21)];
    _text.textColor = [UIColor whiteColor];
    _text.textAlignment = NSTextAlignmentCenter;
    _text.font = [UIFont boldSystemFontOfSize:17];
    _text.text = self.userName;
    [self.navigationController.navigationBar addSubview:_text];
    
    UIButton *left = [UIButton buttonWithType:UIButtonTypeCustom];
    
    left.frame = CGRectMake(0, 10, 15, 21);
    
    [left setImage:[UIImage imageNamed:@"fanhui_back"] forState:UIControlStateNormal];
    
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:left];
    
    [left addTarget:self action:@selector(leftBarButtonItemPressed:) forControlEvents:UIControlEventTouchUpInside];

}
- (void)leftBarButtonItemPressed:(id)sender{
    [self.view endEditing:YES];
    [super leftBarButtonItemPressed:sender];
    [self.navigationController popViewControllerAnimated:YES];
    
}
- (UIStatusBarStyle)preferredStatusBarStyle {
//    NSLog(@"preferredStatusBarStyle :%@", [self class]);
    return mStatusBarStyle;
}


- (void)presentLocationViewController:(RCLocationMessage *)locationMessageContent{
    
    RCLocationViewController *vc = [[RCLocationViewController alloc]init];
    vc.location = locationMessageContent.location;
    vc.locationName = locationMessageContent.locationName;

    UINavigationController *nav = [[UINavigationController alloc]
                                   initWithRootViewController:vc];
    [self presentViewController:nav animated:YES completion:nil];
    // [super presentLocationViewController:locationMessageContent];
    
}
- (void)pluginBoardView:(RCPluginBoardView *)pluginBoardView clickedItemWithTag:(NSInteger)tag{
    
    [super pluginBoardView:pluginBoardView clickedItemWithTag:tag];
    //    if (tag == 1003) {
    //        //@"8dingbu_bj.png"
    ////        [self.navigationController.navigationBar setBackgroundImage:nil forBarMetrics:UIBarMetricsDefault];
    ////        self.navigationController.navigationBar.barTintColor = [UIColor colorWithWhite:0.9 alpha:1];
    //
    //        RCLocationPickerViewController *vc = [[RCLocationPickerViewController alloc]init];
    //        [self.navigationController pushViewController:vc animated:YES];
    //    }else{
    //        [super pluginBoardView:pluginBoardView clickedItemWithTag:tag];
    //    }
    //   
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
